package com.topcoder.srm510;

public class TheAlmostLuckyNumbersDivTwo {
	public int find(int a, int b) {
		int total = 0;
		for (int i=a; i<=b; i++) {
			int count = 0;
			int t = i;
			while (t > 0 && count < 2) {
				int r = t%10;
				if (r != 4 && r != 7) count++;
				t = t / 10;
			}
			
			if (count <= 1) total++; 
		}
		return total;
	}
}
